package com.cpp.server.context;


import com.cpp.pojo.pojo.User;

/**
 * @author Ziahh
 * @description 基于session的用户获取
 * @since 2024/11/14
 */
public class UserHolder {

    public static ThreadLocal<User> threadLocal = new ThreadLocal<>();

    public static void setCurrentUser(User user) {
        threadLocal.set(user);
    }

    public static User getCurrentUser() {
        return threadLocal.get();
    }

    public static void removeCurrentId() {
        threadLocal.remove();
    }

}
